package ldk.util.layoutmanagers.adapter;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import java.util.Random;

import butterknife.BindView;
import butterknife.ButterKnife;
import ldk.util.layoutmanagers.R;

/**
 * Created by ldkxingzhe@163.com on 2017/8/11.
 */

public class AnchorViewHolder extends RecyclerView.ViewHolder{
    private static final String TAG = "AnchorViewHolder";

    @BindView(R.id.tv_tag)
    public TextView textView;
    @BindView(R.id.tv_position)
    public TextView tvPosition;

    public AnchorViewHolder(View itemView) {
        super(itemView);
        ButterKnife.bind(this,itemView);
    }

    public AnchorViewHolder(ViewGroup parent){
        this(LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_anchor, parent, false));
    }

    public void show(String message){
        textView.setText(message);
        Random random = new Random();
        ViewGroup.LayoutParams layoutParams = textView.getLayoutParams();
        layoutParams.height = 80 + random.nextInt(200);
        textView.setLayoutParams(layoutParams);
    }
}
